*******************************************************************************************
*******************************************************************************************
******************** Reclassification Risk in the Small Group Health Insurance Market
******************* by Sebastian Fleitas, Gautam Gowrisankaran and Anthony Lo Sasso 
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************
******************** Table C1
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************


clear all 
cd "~/Dropbox/ReclassificationRisk/"
use database_individual_level.dta, replace 

 do Restat_Final_Table3_USIC.do
 do Restat_Final_Table4_EnrolleeLevel.do

**************************************************************************************************
**************************************************************************************************
** START OF MEPS ESTIMATES
** TWO STEP REGRESSION USING MEPS (ROBUSTNESS ON NOT TAKING INSURANCE ****************************
**************************************************************************************************
*exit
local beta_age = 0.0140
local beta_sex =  -0.1206
local beta_code_hyper = -0.0021
local beta_code_heart = 0.2738
local beta_code_ami = -0.5455
local beta_code_brain = -0.3575
local beta_code_respfail = 0.1986 
local beta_code_cancer = -0.1672
local beta_code_diabetes = 0.5817
local beta_code_ashtma =  0.0821
local beta_ind1 = 0.8550
local beta_ind2 = 0
local beta_ind3 = 1.1654
local beta_ind4 = 1.1756
local beta_ind5 = 1.0976
local beta_ind6 = 0.8793
local beta_ind7 = 1.1200
local beta_ind8 = 0.9822
local beta_ind9 = 1.6811
local beta_firmsize = 0.0018
 /*
local beta_age = 0.0174187
local beta_sex =  -0.0530324
local beta_code_hyper = -0.0226049
local beta_code_heart = 0.3015409
local beta_code_ami = -0.0967591
local beta_code_brain = -0.0133648
local beta_code_respfail = 0.3502132
local beta_code_cancer = 0.0056923
local beta_code_diabetes = 0.0620923
local beta_code_ashtma =  -0.0749203
local beta_ind1 = -2.973374
local beta_ind2 = -0.5271005
local beta_ind3 = -2.534678
local beta_ind4 = -2.124368
local beta_ind5 = -2.350805
local beta_ind6 = -2.375391
local beta_ind7 = -2.286985
local beta_ind8 = -2.531273
local beta_ind9 = -1.485979
local beta_firmsize = 0.0166855
*/
*****
*INDEX
gen index2 = `beta_age'* age + `beta_sex'* SEX +  `beta_code_hyper'* lagged_code_hypertension + `beta_code_heart'* lagged_code_heartfailure  + `beta_code_ami'* lagged_chronic_ami + `beta_code_brain'* lagged_code_brainhemorr + `beta_code_respfail'* laggeed_code_respfailure  + `beta_code_cancer'* lagged_chronic_cancer + `beta_code_diabetes'* lagged_chronic_diabetes + `beta_code_ashtma'* lagged_code_asthma + `beta_ind1'* industy_dummy1 + `beta_ind2'* industy_dummy2 + `beta_ind3'* industy_dummy3 + `beta_ind4'* industy_dummy4 + `beta_ind5'* industy_dummy5 + `beta_ind6'* industy_dummy6 + `beta_ind7'* industy_dummy7 + `beta_ind8'* industy_dummy8 + `beta_ind9'* industy_dummy9 + `beta_firmsize'* numpeople  
gen prob_meps = normprob(index2)
gen prob_meps2 = prob_meps^2
gen prob_meps3 = prob_meps^3
gen prob_meps4 = prob_meps^4
gen prob_meps5 = prob_meps^5
gen prob_meps6 = prob_meps^6
**************************************************************************************************
*xtreg mean_premium mean_pred_riskscore_rp  yeardum* , fe cl(customer_number)
reghdfe mean_premium mean_pred_riskscore_rp  yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
*xtreg mean_premium mean_pred_riskscore_rp   prob_meps  yeardum* , fe cl(customer_number)
reghdfe mean_premium mean_pred_riskscore_rp prob_meps yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
*xtreg mean_premium mean_pred_riskscore_rp   prob_meps*  yeardum* , fe cl(customer_number)
reghdfe mean_premium mean_pred_riskscore_rp prob_meps* yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)

*regress  mean_premium mean_pred_riskscore_rp  marketdum* yeardum* , cl(customer_number)
reghdfe  mean_premium mean_pred_riskscore_rp  marketdum* yeardum* if sample==1 , noabsorb vce(cluster customer_number year)

*regress  mean_premium mean_pred_riskscore_rp  marketdum* prob_meps yeardum* , cl(customer_number)
reghdfe  mean_premium mean_pred_riskscore_rp  prob_meps marketdum* yeardum* if sample==1  , noabsorb vce(cluster customer_number year)

*regress  mean_premium mean_pred_riskscore_rp   marketdum* prob_meps* yeardum* , cl(customer_number)
reghdfe  mean_premium mean_pred_riskscore_rp  prob_meps* marketdum* yeardum* if sample==1 , noabsorb vce(cluster customer_number year)

**************************************************************************************************
*END OF MEPS ESTIMATES
*exit

